<template>
	<view>
		<view class="non-text">
			<view class="title">
				{{detail?.title}}
			</view>
			<view class="author">
				{{detail?.author}}
			</view>
			<view class="publish-time">
				{{detail?.publishTime}}
			</view>
			<view class="settle-type">
				{{detail?.settleType}}
			</view>
			<view class="employ-type">
				{{detail?.employType}}
			</view>
			<view class="employ-num">
				{{detail?.employNum}}
			</view>
		</view>
		<view class="main-content">
			<rich-text>{{detail?.content}}</rich-text>
			<view class="contactP">{{detail?.contactP}}</view>
			<view class="contact">{{detail?.contact}}</view>
		</view>
	</view>
</template>

<script setup lang="ts">
import { queryById } from '@/api/info/InfoDataController';
import { InfoDataModel } from '@/entity/home/InfoDataModel';
import { onLoad } from '@dcloudio/uni-app';
import { ref, onMounted} from 'vue';
	const infoId = ref<string>("");
	const detail = ref<InfoDataModel>();
	const loadDetail = async (id :string) : Promise<InfoDataModel> => {
		return await queryById(id);
	}
	onLoad((option :any) => {
		infoId.value = option.id
		console.log("跳转携带的参数: " + infoId.value);
	})
	onMounted(async () => {
		try{
			detail.value = await loadDetail(infoId.value)
		}catch(error) {
			console.error("查询招工信息详情失败",error)
			const model = new InfoDataModel();
			model.setAuthor("");
			model.setId("");
			model.setTitle("");
			model.setUpdateTime(new Date());
			model.setEmployNum("");
			model.setEmployType("");
			model.setSettleType("");
			model.setPublishTime(new Date());
			model.setContact("");
			model.setContactP("");
			model.setContent("")
		}
	})

</script>

<style lang="scss">

</style>